home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / shell / csh548src.lha / Custom_Headers / libraries / multiuser.h < prev    next >
C/C++ Source or Header  |  1994-07-02  |  18KB  |  523 lines

  1. #ifndef LIBRARIES_MULTIUSER_H
  2. #define LIBRARIES_MULTIUSER_H
  3. /*
  4. **      $VER: multiuser.h 39.14 (29.6.94)
  5. **      MultiUser Release 1.8
  6. **
  7. **      multiuser.library definitions
  8. **
  9. **      (C) Copyright 1993-1994 Geert Uytterhoeven
  10. **          All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif  /* EXEC_TYPES_H */
  16.  
  17. #ifndef EXEC_LISTS_H
  18. #include <exec/lists.h>
  19. #endif  /* EXEC_LISTS_H */
  20.  
  21. #ifndef EXEC_LIBRARIES_H
  22. #include <exec/libraries.h>
  23. #endif  /* EXEC_LIBRARIES_H */
  24.  
  25. #ifndef EXEC_EXECBASE_H
  26. #include <exec/execbase.h>
  27. #endif  /* EXEC_EXECBASE_H */
  28.  
  29. #ifndef EXEC_PORTS_H
  30. #include <exec/ports.h>
  31. #endif  /* EXEC_PORTS_H */
  32.  
  33. #ifndef LIBRARIES_DOS_H
  34. #include <libraries/dos.h>
  35. #endif  /* LIBRARIES_DOS_H */
  36.  
  37. #ifndef UTILITY_TAGITEM_H
  38. #include <utility/tagitem.h>
  39. #endif  /* UTILITY_TAGITEM_H */
  40.  
  41. #ifndef LIBRARIES_LOCALE_H
  42. #include <libraries/locale.h>
  43. #endif /* LIBRARIES_LOCALE_H */
  44.  
  45. #define MULTIUSERNAME         "multiuser.library"
  46. #define MULTIUSERVERSION      (39)
  47.  
  48. #define MULTIUSERCATALOGNAME    "multiuser.catalog"
  49. #define MULTIUSERCATALOGVERSION (1)
  50.  
  51.    /*
  52.     *    Reserved users/groups
  53.     *
  54.     *    WARNING: a uid may NOT be zero, a gid may be zero
  55.     */
  56.  
  57. #define muOWNER_NOBODY  (0x00000000)   /* no rights */
  58. #define muOWNER_SYSTEM  (0xffffffff)   /* always owner */
  59.  
  60. #define muMASK_UID      (0xffff0000)   /* Mask for uid bits */
  61. #define muMASK_GID      (0x0000ffff)   /* Mask for gid bits */
  62.  
  63. #define muROOT_UID      (0xffff)       /* super user uid */
  64. #define muROOT_GID      (0xffff)       /* super user gid */
  65.  
  66. #define muNOBODY_UID    (0x0000)       /* nobody uid */
  67.  
  68. #define muUSERIDSIZE    (32)           /* Maximum size for a User ID */
  69. #define muGROUPIDSIZE   (32)           /* Maximum size for a Group ID */
  70. #define muPASSWORDSIZE  (32)           /* Maximum size for a Password */
  71. #define muUSERNAMESIZE  (220)          /* Maximum size for a User Name */
  72. #define muGROUPNAMESIZE (220)          /* Maximum size for a Group Name */
  73. #define muHOMEDIRSIZE   (256)          /* Maximum size for a Home Directory */
  74. #define muSHELLSIZE     (256)          /* Maximum size for a Shell */
  75.  
  76.  
  77.    /*
  78.     *    Password File
  79.     *
  80.     *
  81.     *    For each user, the Password File must contain a line like this:
  82.     *
  83.     *    <UserID>|<Password>|<uid>|<gid>|<UserName>|<HomeDir>|<Shell>
  84.     *
  85.     *    with:
  86.     *
  87.     *       <UserID>    User Login ID (max. muUSERIDSIZE-1 characters)
  88.     *       <PassKey>   Encrypted Password
  89.     *       <uid>       User Number (1 - 65535)
  90.     *       <gid>       Primary Group Number (0 - 65535)
  91.     *       <UserName>  Full User Name (max. muUSERNAMESIZE-1 characters)
  92.     *       <HomeDir>   Home directory (max. muHOMEDIRSIZE-1 characters)
  93.     *       <Shell>     Default Shell (max. muSHELLSIZE-1 characters)
  94.     *                   (not used yet, AS225 compatibility)
  95.     */
  96.  
  97. #define muPasswd_FileName     "passwd"  /* for AS225 compatibility */
  98.  
  99.  
  100.    /*
  101.     *    Group File
  102.     *
  103.     *
  104.     *    This file gives more information about the groups and defines
  105.     *    the secondary groups (other than the primary group) a user
  106.     *    belongs to. It exists out of two parts, separated by a blank line.
  107.     *
  108.     *    The first part contains lines with the format:
  109.     *
  110.     *    <GroupID>|<gid>|<MgrUid>|<GroupName>
  111.     *
  112.     *    with:
  113.     *
  114.     *       <GroupID>   Group short ID (max. muGROUPIDSIZE-1 characters)
  115.     *       <gid>       Group Number (0 - 65535)
  116.     *       <MgrUid>    User Number of this group's manager, 0 for no
  117.     *                   manager. A group's manager must not belong to the
  118.     *                   group.
  119.     *       <GroupName> Full Group Name (max. muGROUPNAMESIZE-1 characters)
  120.     *
  121.     *    NOTE: Not every group must have a line in this file, but at least
  122.     *          one group must have one.
  123.     *
  124.     *
  125.     *    The seconds part contains lines with the format:
  126.     *
  127.     *    <uid>:<gid>[,<gid>...]
  128.     *
  129.     *    with:
  130.     *
  131.     *       <uid>       User Number (1-65535)
  132.     *       <gid>       Group Number (0 - 65535)
  133.     *
  134.     *    If you think you'll exceed the maximum line length (circa 1K),
  135.     *    you may use more than one line per user.
  136.     */
  137.  
  138. #define muGroup_FileName      "MultiUser.group"
  139.  
  140.  
  141.    /*
  142.     *    Configuration File
  143.     *
  144.     *
  145.     *    This file contains lines with options in the form <OPT>=<val>.
  146.     *    0 is used for OFF, 1 for ON.
  147.     *    Defaults to the values between square brackets.
  148.     *
  149.     *    LIMITDOSSETPROTECTION   dos.library/SetProtection() cannot change
  150.     *                            protection bits for GROUP and OTHER [1]
  151.     *    PROFILE                 execute the Profile if it exists [1]
  152.     *    LASTLOGINREQ            display the Lastlogin requester [1]
  153.     *    LOGSTARTUP              log startup [0]
  154.     *    LOGLOGIN                log successful logins [0]
  155.     *    LOGLOGINFAIL            log failed logins [0]
  156.     *    LOGPASSWD               log successful password changes [0]
  157.     *    LOGPASSWDFAIL           log failed password changes [0]
  158.     *    LOGCHECKPASSWD          log successful password checks [0]
  159.     *    LOGCHECKPASSWDFAIL      log failed password checks [0]
  160.     *    PASSWDUIDLEVEL          users with a uid greather than or equal to
  161.     *                            <val> can change their passwords [0]
  162.     *    PASSWDGIDLEVEL          users with a gid greather than or equal to
  163.     *                            <val> can change their passwords [0]
  164.     *
  165.     *    NOTE: if a user has a uid less than the PASSWDUIDLEVEL AND a gid
  166.     *          less than PASSWDGIDLEVEL he/she is NOT allowed to change
  167.     *          his/her password!
  168.     */
  169.  
  170. #define muConfig_FileName     "MultiUser.config"
  171.  
  172.  
  173.    /*
  174.     *    Log File
  175.     */
  176.  
  177. #define muLog_FileName        "MultiUser.log"
  178.  
  179.  
  180.    /*
  181.     *    Lastlogin File
  182.     */
  183.  
  184. #define muLastLogin_FileName  ".lastlogin"
  185.  
  186.  
  187.    /*
  188.     *    Profile
  189.     */
  190.  
  191. #define muProfile_FileName    ".profile"
  192.  
  193.  
  194.    /*
  195.     *    Plan file
  196.     */
  197.  
  198. #define muPlan_FileName       ".plan"
  199.  
  200.  
  201.    /*
  202.     *    Key File
  203.     *
  204.     *
  205.     *    This file must be present in the root directory of every volume
  206.     *    that uses the MultiUserFileSystem. It must contain 3 lines:
  207.     *
  208.     *       - a pseudo random ASCII key (max. 1023 characters).
  209.     *       - the directory of the password file, if located on this volume,
  210.     *         otherwise an empty line (no spaces!).
  211.     *           e.g. ":MultiUser"
  212.     *           e.g. ":inet/db" for AS225 compatibility
  213.     *       - the directory of the configuration file, if located on this
  214.     *         volume, otherwise an empty line (no spaces!).
  215.     *           e.g. ":MultiUser"
  216.     *
  217.     *    If there is ANY inconsistency the system will refuse to work!!
  218.     */
  219.  
  220. #define muKey_FileName        ":.MultiUser.keyfile"
  221.  
  222.  
  223.    /*
  224.     *    Tags for muLogoutA()
  225.     *             muLoginA()
  226.     *             muSetDefProtectionA()
  227.     */
  228.  
  229. #define muT_Input          (TAG_USER+1)   /* filehandle - default is Input() */
  230. #define muT_Output         (TAG_USER+2)   /* filehandle - default is Output() */
  231. #define muT_Graphical      (TAG_USER+3)   /* boolean - default is FALSE */
  232. #define muT_PubScrName     (TAG_USER+4)   /* name of public screen */
  233. #define muT_Task           (TAG_USER+5)   /* task (NOT the name!!) */
  234. #define muT_Own            (TAG_USER+6)   /* make a task owned by this user */
  235. #define muT_Global         (TAG_USER+7)   /* change it for all tasks on the */
  236.                                           /* same level as this one */
  237. #define muT_Quiet          (TAG_USER+8)   /* for muLogoutA(), don't give a */
  238.                                           /* login prompt, simply logout */
  239. #define muT_UserID         (TAG_USER+9)   /* UserID for muLoginA() */
  240. #define muT_Password       (TAG_USER+10)  /* Password for muLoginA(), must */
  241.                                           /* be combined with muT_UserID!! */
  242. #define muT_DefProtection  (TAG_USER+11)  /* Default protection bits */
  243.                                           /* default is RWED GROUP R OTHER R */
  244. #define muT_All            (TAG_USER+12)  /* for muLogoutA(), logout until */
  245.                                           /* user stack is empty */
  246. #define muT_NoLog          (TAG_USER+13)  /* for muLoginA(), only root */
  247.  
  248.  
  249.    /*
  250.     *    Public User Information Structure
  251.     *
  252.     *
  253.     *    For future compatibility, you should ALWAYS use muAllocUserInfo()
  254.     *    to allocate this structure. NEVER do it by yourself!!
  255.     */
  256.  
  257. struct muUserInfo {
  258.    char UserID[muUSERIDSIZE];
  259.    UWORD uid;
  260.    UWORD gid;
  261.    char UserName[muUSERNAMESIZE];
  262.    char HomeDir[muHOMEDIRSIZE];
  263.    UWORD NumSecGroups;              /* Number of Secondary Groups this */
  264.                                     /* user belongs to */
  265.    UWORD *SecGroups;                /* Points to an array of NumSecGroups */
  266.                                     /* Secondary Group Numbers */
  267.    char Shell[muSHELLSIZE];
  268. };
  269.  
  270.  
  271.    /*
  272.     *    Public Group Information Structure
  273.     *
  274.     *
  275.     *    For future compatibility, you should ALWAYS use muAllocGroupInfo()
  276.     *    to allocate this structure. NEVER do it by yourself!!
  277.     */
  278.  
  279. struct muGroupInfo {
  280.    char GroupID[muGROUPIDSIZE];
  281.    UWORD gid;
  282.    UWORD MgrUid;                    /* Manager of this group */
  283.    char GroupName[muGROUPNAMESIZE];
  284. };
  285.  
  286.  
  287.    /*
  288.     *    KeyTypes for muGetUserInfo()
  289.     *                 muGetGroupInfo()
  290.     */
  291.  
  292. #define muKeyType_First          (0)
  293. #define muKeyType_Next           (1)
  294. #define muKeyType_gid            (4)
  295.  
  296.    /*
  297.     *    KeyTypes for muGetUserInfo() only
  298.     */
  299.  
  300. #define muKeyType_UserID         (2)   /* Case-sensitive */
  301. #define muKeyType_uid            (3)
  302. #define muKeyType_gidNext        (5)
  303. #define muKeyType_UserName       (6)   /* Case-insensitive */
  304. #define muKeyType_WUserID        (7)   /* Case-insensitive, wild cards allowed */
  305. #define muKeyType_WUserName      (8)   /* Case-insensitive, wild cards allowed */
  306. #define muKeyType_WUserIDNext    (9)
  307. #define muKeyType_WUserNameNext  (10)
  308.  
  309.    /*
  310.     *    KeyTypes for muGetGroupInfo() only
  311.     */
  312.  
  313. #define muKeyType_GroupID        (11)  /* Case-sensitive */
  314. #define muKeyType_WGroupID       (12)  /* Case-insensitive, wild cards allowed */
  315. #define muKeyType_WGroupIDNext   (13)
  316. #define muKeyType_GroupName      (14)  /* Case-insensitive */
  317. #define muKeyType_WGroupName     (15)  /* Case-insensitive, wild cards allowed */
  318. #define muKeyType_WGroupNameNext (16)
  319. #define muKeyType_MgrUid         (17)
  320. #define muKeyType_MgrUidNext     (18)
  321.  
  322.  
  323.    /*
  324.     *    Extended Owner Information Structure
  325.     *
  326.     *
  327.     *    A pointer to this structure is returned by muGetTaskExtOwner().
  328.     *    You MUST use muFreeExtOwner() to deallocate it!!
  329.     */
  330.  
  331. struct muExtOwner {
  332.    UWORD uid;
  333.    UWORD gid;
  334.    UWORD NumSecGroups;              /* Number of Secondary Groups this */
  335.                                     /* user belongs too. */
  336. };
  337.  
  338.    /* NOTE: This structure is followed by a UWORD array containing
  339.     *       the Secondary Group Numbers
  340.     *       Use the following macro to access these group numbers,
  341.     *       e.g. sgid = muSecGroups(extowner)[i];
  342.     *
  343.     *       Do not use this macro on a NULL pointer!!
  344.     */
  345.  
  346. #define muSecGroups(x) ((UWORD *)((UBYTE *)x+sizeof(struct muExtOwner)))
  347.  
  348.  
  349.    /*
  350.     *    Macro to convert an Extended Owner Information Structure to a ULONG
  351.     *    (cfr. muGetTaskOwner())
  352.     */
  353.  
  354. #define muExtOwner2ULONG(x) ((ULONG)(x ? (x)->uid<<16|(x)->gid : muOWNER_NOBODY))
  355.  
  356.  
  357.    /*
  358.     *    Packet types (see also <dos/dosextens.h> :-)
  359.     */
  360.  
  361. /* #define ACTION_SET_OWNER        1036 */
  362.  
  363.  
  364.    /*
  365.     *    Protection bits (see also <dos/dos.h> :-)
  366.     */
  367.  
  368. #define muFIBB_SET_UID        (31)  /* Change owner during execution */
  369.  
  370. /* FIBB are bit definitions, FIBF are field definitions */
  371. /* Regular RWED bits are 0 == allowed. */
  372. /* NOTE: GRP and OTR RWED permissions are 0 == not allowed! */
  373.  
  374. /* #define FIBB_OTR_READ      15   Other: file is readable */
  375. /* #define FIBB_OTR_WRITE     14   Other: file is writable */
  376. /* #define FIBB_OTR_EXECUTE   13   Other: file is executable */
  377. /* #define FIBB_OTR_DELETE    12   Other: prevent file from being deleted */
  378. /* #define FIBB_GRP_READ      11   Group: file is readable */
  379. /* #define FIBB_GRP_WRITE     10   Group: file is writable */
  380. /* #define FIBB_GRP_EXECUTE   9    Group: file is executable */
  381. /* #define FIBB_GRP_DELETE    8    Group: prevent file from being deleted */
  382.  
  383. /* #define FIBB_SCRIPT        6    program is a script (execute) file */
  384. /* #define FIBB_PURE          5    program is reentrant and rexecutable */
  385. /* #define FIBB_ARCHIVE       4    cleared whenever file is changed */
  386. /* #define FIBB_READ          3    ignored by old filesystem */
  387. /* #define FIBB_WRITE         2    ignored by old filesystem */
  388. /* #define FIBB_EXECUTE       1    ignored by system, used by Shell */
  389. /* #define FIBB_DELETE        0    prevent file from being deleted */
  390.  
  391. #define muFIBF_SET_UID        (1<<muFIBB_SET_UID)
  392.  
  393. /* #define FIBF_OTR_READ      (1<<FIBB_OTR_READ) */
  394. /* #define FIBF_OTR_WRITE     (1<<FIBB_OTR_WRITE) */
  395. /* #define FIBF_OTR_EXECUTE   (1<<FIBB_OTR_EXECUTE) */
  396. /* #define FIBF_OTR_DELETE    (1<<FIBB_OTR_DELETE) */
  397. /* #define FIBF_GRP_READ      (1<<FIBB_GRP_READ) */
  398. /* #define FIBF_GRP_WRITE     (1<<FIBB_GRP_WRITE) */
  399. /* #define FIBF_GRP_EXECUTE   (1<<FIBB_GRP_EXECUTE) */
  400. /* #define FIBF_GRP_DELETE    (1<<FIBB_GRP_DELETE) */
  401.  
  402. /* #define FIBF_SCRIPT        (1<<FIBB_SCRIPT) */
  403. /* #define FIBF_PURE          (1<<FIBB_PURE) */
  404. /* #define FIBF_ARCHIVE       (1<<FIBB_ARCHIVE) */
  405. /* #define FIBF_READ          (1<<FIBB_READ) */
  406. /* #define FIBF_WRITE         (1<<FIBB_WRITE) */
  407. /* #define FIBF_EXECUTE       (1<<FIBB_EXECUTE) */
  408. /* #define FIBF_DELETE        (1<<FIBB_DELETE) */
  409.  
  410.  
  411.    /*
  412.     *    Default Protection Bits
  413.     */
  414.  
  415. #define DEFPROTECTION (FIBF_OTR_READ | FIBF_GRP_READ)
  416.  
  417.  
  418.    /*
  419.     *    Relations returned by muGetRelationshipA()
  420.     */
  421.  
  422. #define muRelB_ROOT_UID    (0)   /* User == super user */
  423. #define muRelB_ROOT_GID    (1)   /* User belongs to the super user group */
  424. #define muRelB_NOBODY      (2)   /* User == nobody */
  425. #define muRelB_UID_MATCH   (3)   /* User == owner */
  426. #define muRelB_GID_MATCH   (4)   /* User belongs to owner group */
  427. #define muRelB_PRIM_GID    (5)   /* User's primary group == owner group */
  428. #define muRelB_NO_OWNER    (6)   /* Owner == nobody */
  429.  
  430. #define muRelF_ROOT_UID    (1<<muRelB_ROOT_UID)
  431. #define muRelF_ROOT_GID    (1<<muRelB_ROOT_GID)
  432. #define muRelF_NOBODY      (1<<muRelB_NOBODY)
  433. #define muRelF_UID_MATCH   (1<<muRelB_UID_MATCH)
  434. #define muRelF_GID_MATCH   (1<<muRelB_GID_MATCH)
  435. #define muRelF_PRIM_GID    (1<<muRelB_PRIM_GID)
  436. #define muRelF_NO_OWNER    (1<<muRelB_NO_OWNER)
  437.  
  438.  
  439.    /*
  440.     *    Monitor Structure
  441.     *
  442.     *
  443.     *    The use of this structure is restricted to root.
  444.     *    Do not modify or reuse this structure while it is active!
  445.     */
  446.  
  447. struct muMonitor {
  448.    struct MinNode Node;
  449.    ULONG Mode;                      /* see definitions below */
  450.    ULONG Triggers;                  /* see definitions below */
  451.    union {
  452.       struct {                      /* for SEND_SIGNAL */
  453.          struct Task *Task;
  454.          ULONG SignalNum;
  455.       } Signal;
  456.  
  457.       struct {                      /* for SEND_MESSAGE */
  458.          struct MsgPort *Port;
  459.       } Message;
  460.    };
  461.  
  462.    /* NOTE: This structure may be extended in future! */
  463. };
  464.  
  465.    /*
  466.     *    Monitor Modes
  467.     */
  468.  
  469. #define muMon_IGNORE       (0)
  470. #define muMon_SEND_SIGNAL  (1)
  471. #define muMon_SEND_MESSAGE (2)
  472.  
  473.    /*
  474.     *    Monitor Message
  475.     *
  476.     *
  477.     *    Sent to the application if SEND_MESSAGE is specified.
  478.     *    Do NOT forget to reply!
  479.     */
  480.  
  481. struct muMonMsg {
  482.    struct Message ExecMsg;
  483.    struct muMonitor *Monitor;       /* The monitor that sent the message */
  484.    ULONG Trigger;                   /* The trigger that caused the message */
  485.    UWORD From;
  486.    UWORD To;
  487.    char UserID[muUSERIDSIZE];
  488. };
  489.  
  490.    /*
  491.     *    Monitor Triggers
  492.     */
  493.  
  494. #define muTrgB_OwnerChange       (0)   /* Task Owner Change */
  495.                                        /*    From:    uid of old user */
  496.                                        /*    To:      uid of new user */
  497. #define muTrgB_Login             (1)   /* successful Login/Logout */
  498.                                        /*    From:    uid of old user */
  499.                                        /*    To:      uid of new user */
  500.                                        /*    UserID:  UserID of new user */
  501. #define muTrgB_LoginFail         (2)   /* unsuccessful Login/Logout */
  502.                                        /*    From:    uid of old user */
  503.                                        /*    UserID:  UserID of new user */
  504. #define muTrgB_Passwd            (3)   /* successful Passwd */
  505.                                        /*    From:    uid of user */
  506. #define muTrgB_PasswdFail        (4)   /* unsuccessful Passwd */
  507.                                        /*    From:    uid of user */
  508. #define muTrgB_CheckPasswd       (5)   /* successful CheckPasswd */
  509.                                        /*    From:    uid of user */
  510. #define muTrgB_CheckPasswdFail   (6)   /* unsuccessful CheckPasswd */
  511.                                        /*    From:    uid of user */
  512.  
  513. #define muTrgF_OwnerChange       (1<<muTrgB_OwnerChange)
  514. #define muTrgF_Login             (1<<muTrgB_Login)
  515. #define muTrgF_LoginFail         (1<<muTrgB_LoginFail)
  516. #define muTrgF_Passwd            (1<<muTrgB_Passwd)
  517. #define muTrgF_PasswdFail        (1<<muTrgB_PasswdFail)
  518. #define muTrgF_CheckPasswd       (1<<muTrgB_CheckPasswd)
  519. #define muTrgF_CheckPasswdFail   (1<<muTrgB_CheckPasswdFail)
  520.  
  521.  
  522. #endif  /* LIBRARIES_MULTIUSER_H */
  523.